﻿<!--
Majesty of Omega - The next evolution of macro management space strategy

Copyright 2007 Andr Claassen

This file is protected by the terms and conditions of the
Microsoft Community License (Ms-CL 1.1), a copy of which should
have been distributed along with this software. If not,
you may find the license information at the following URL:

http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx
-->

<Page
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Majesty_of_Omega_Config="clr-namespace:Majesty_of_Omega.Config;assembly=Majesty_of_Omega_BL"
    xmlns:Majesty_of_Omega_ValueConverters="clr-namespace:Majesty_of_Omega.GUI.ValueConverters;assembly="
    xmlns:Majesty_of_Omega_Parts="clr-namespace:Majesty_of_Omega.GUI.Pages.Setup.Parts"
    xmlns:Controls="clr-namespace:Majesty_of_Omega.GUI.Controls;assembly="
    Style="{StaticResource PageSetupStyle}"
	x:Class="Majesty_of_Omega.GUI.Pages.Setup.Step1_ChooseRacePage"
	x:Name="Page"
	WindowTitle="Page"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
  >
    <Page.Resources>
        <ResourceDictionary>
            <ObjectDataProvider x:Key="SpreadSheetManagerDS" ObjectType="{x:Type Majesty_of_Omega_Config:SpreadSheetManager}"/>
            <Majesty_of_Omega_ValueConverters:SpeciesToRaceConverter x:Key="SpeciesToRaceConverter"/>
            <Style x:Key="RacePickDefaultStyle" TargetType="{x:Type TextBlock}">
                <Setter Property="Foreground" Value="#FFFFFFFF"/>
                <Setter Property="Margin" Value="12,4,0,4"  />
                <Setter Property="VerticalAlignment" Value="Center" />
            </Style>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FF014885" />
        </ResourceDictionary>
    </Page.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.2*" />
            <ColumnDefinition Width="0.2*" />
            <ColumnDefinition Width="0.2*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="80"/>
            <RowDefinition Height="0.881*" />
            <RowDefinition Height="0.119*"/>
        </Grid.RowDefinitions>

        <!-- User Control with the Page Title Box -->
        <Majesty_of_Omega_Parts:SetupTitlePart TitleString="Choose Race" Grid.ColumnSpan="3" />

        <!-- Left Panel with all species -->
        <Controls:SetupPanelControl Background="#FF0D0231"  Grid.Column="0" Grid.Row="1" Header="SetupPanelControl">
            <!-- Panel of Buttons for selecting the species planet  -->
            <ListBox
					x:Name="SpeciesList"
					ItemsSource ="{Binding Path=RaceModifiers.Species, Mode=Default, Source={StaticResource SpreadSheetManagerDS}}"
					SelectedValue="{Binding Path=SelectedSpecies, Mode=TwoWay}"
					Background="{x:Null}" BorderBrush="{x:Null}"
					OverridesDefaultStyle="False"
					HorizontalContentAlignment="Stretch"
					VerticalContentAlignment="Top"
					VerticalAlignment="Top"
					SelectionChanged="SpeciesList_SelectionChanged"
                 >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border x:Name="speciesButtonBorder"
								Margin="8,4,0,4"
								Background="{DynamicResource PanelBackgroundBrush}"
								BorderBrush="#FFFFFFFF"
								BorderThickness="2,2,2,2"
								CornerRadius="4,0,0,4"
								Padding="0,4,0,4"
								HorizontalAlignment="Stretch" VerticalAlignment="Center"
								Width="Auto"
                      >
                            <TextBlock HorizontalAlignment="Center" Text="{Binding}"  />
							</Border>
                        <DataTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True" >
                                <Setter Property="Background" TargetName="speciesButtonBorder" Value="#FFF69217"/>
                            </Trigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Controls:SetupPanelControl>

        <!-- Race List Panel  -->
        <Border x:Name="RaceListBorder" Style="{DynamicResource PanelBorderStyle}" Margin="10,0,10,0" Grid.Column="1" Grid.Row="1" VerticalAlignment="Stretch" >
            <ListBox x:Name="RaceListListBox"
				HorizontalContentAlignment="Stretch"
				Background="{DynamicResource SubTitelBrush}"
				BorderBrush="{x:Null}"
				VerticalContentAlignment="Top"
				ItemsSource="{Binding Path=SelectedValue, Converter={StaticResource SpeciesToRaceConverter}, ElementName=SpeciesList, Mode=Default}"
				SelectedValue="{Binding Path=SelectedRace}"
                >

                <ListBox.ItemTemplate>
                    <DataTemplate >
                        <Border x:Name="speciesRaceBorder" Width="Auto" Height="Auto" BorderBrush="#FF000000" BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
                            <StackPanel HorizontalAlignment="Stretch" Height="112" >
                                <Border Width="Auto" Height="24" Style="{DynamicResource LightSubTitleBorderStyle}">
                                    <TextBlock
										HorizontalAlignment="Center" VerticalAlignment="Center"
										Width="Auto" Height="Auto" FontSize="12" FontWeight="Bold" Text="{Binding Path=Name}"/>
								</Border>
                                <ItemsControl Width="Auto" Height="Auto"
									Background="{x:Null}"
									BorderBrush="{x:Null}"
									ItemsSource="{Binding Path=DefaultRacePicks, Mode=Default}" >
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate >
                                            <TextBlock Style="{DynamicResource RacePickDefaultStyle}" Text="{Binding}" />
										</DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                            </StackPanel>
                        </Border>
                        <DataTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" TargetName="speciesRaceBorder" Value="#FFEE730E"/>
                            </Trigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Border>

        <!-- User Control with the Race Info Race="{Binding Path=SelectedValue, ElementName=RaceListListBox, Mode=Default}"-->
        <Majesty_of_Omega_Parts:RaceInfoPart HorizontalAlignment="Stretch"
                                             Grid.Column="2" Grid.Row="1" Margin="10,0,10,0" />

        <!-- Navigation Panel -->
        <Controls:NavigationPanel 
			Grid.ColumnSpan="3" 
			Grid.Row="2" Margin="0,16,0,0" 
			VerticalAlignment="Bottom" 
			NavigatePageForward="Pages/Setup/Step2_RacePickPage.xaml"
            />
    </Grid>
</Page>